import { App } from 'vue'
import 'element-plus/theme-chalk/index.css'
import {
  ElAside,
  ElButton,
  ElCheckbox,
  ElCol,
  ElContainer,
  ElDropdown,
  ElDropdownItem,
  ElDropdownMenu,
  ElForm,
  ElFormItem,
  ElHeader,
  ElInput,
  ElLink,
  ElMain,
  ElMenu,
  ElMenuItem,
  ElSubMenu,
  ElTabPane,
  ElTabs,
  ElRow,
  ElSelect,
  ElDatePicker,
  ElOption,
  ElBreadcrumbItem,
  ElBreadcrumb,
  ElTable,
  ElTableColumn,
  ElPagination,
  ElImage,
  ElDialog,
  ElTree,
  ElAvatar,
  ElUpload,
  ElCard,
  ElTooltip,
  ElCollapse,
  ElCollapseItem,
  ElDescriptions,
  ElDescriptionsItem,
  ElTag,
  ElIcon
} from 'element-plus'

const ELcomponents = [
  ElAside,
  ElButton,
  ElCheckbox,
  ElCol,
  ElContainer,
  ElDropdown,
  ElDropdownItem,
  ElDropdownMenu,
  ElForm,
  ElFormItem,
  ElHeader,
  ElInput,
  ElLink,
  ElMain,
  ElMenu,
  ElMenuItem,
  ElSubMenu,
  ElTabPane,
  ElTabs,
  ElRow,
  ElSelect,
  ElDatePicker,
  ElOption,
  ElBreadcrumbItem,
  ElBreadcrumb,
  ElTable,
  ElTableColumn,
  ElPagination,
  ElImage,
  ElDialog,
  ElTree,
  ElAvatar,
  ElUpload,
  ElCard,
  ElTooltip,
  ElCollapse,
  ElCollapseItem,
  ElDescriptions,
  ElDescriptionsItem,
  ElTag,
  ElIcon
]
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

export default function registerElement(app: App): void {
  for (const cpn of ELcomponents) {
    app.component(cpn.name, cpn)
  }
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
}
